import dayjs from 'dayjs'
export const fromNow = (time) => {
  let result
  if (dayjs(time).isBefore(dayjs().subtract(7, 'days'))) {
    result = dayjs(time).format('YYYY-MM-DD')
  } else {
    result = dayjs(time)
      .locale('zh-cn')
    .from(dayjs())
  }
  return result
}